﻿using System;
using Newtonsoft.Json;

namespace SmartNavigation
{
    public class MethodCallArgument
    {
        private object _value;

        public MethodCallArgument() { }

        public MethodCallArgument(object value)
        {
            Json = JsonConvert.SerializeObject(value);
            _value = value;
        }

        public Type Type { get; set; }
        public string Json { get; set; }
        public object GetValue()
        {
            if (_value == null)
                _value = JsonConvert.DeserializeObject(Json, Type);

            return _value;
        }
    }
}